package com.cy.captcha.factory;

import com.cy.captcha.CaptchaType;
import com.cy.captcha.factory.impl.AbstractCaptcha;
import com.cy.captcha.factory.impl.BlockPuzzleCaptcha;
import com.cy.captcha.factory.impl.ClickWordCaptcha;

/**
 * @author stx
 * @date 2018/11/5 11:11
 * @desc
 */
public class CaptchaFactory implements ICaptchaFactory{

    @Override
    public AbstractCaptcha getInstance(CaptchaType captchaType) {
        if (CaptchaType.CLICK_WORD.getName().equals(captchaType.getName())){
            return new ClickWordCaptcha();
        } else if (CaptchaType.BLOCK_PUZZLE.getName().equals(captchaType.getName())) {
            return new BlockPuzzleCaptcha();
        }
        return null;
    }

}
